﻿#region " | Copyright 2013 | "
/*
 * Copyright 2013
 * Author : Siriwat Suananpornpanit
 * Attibutes
 */
#endregion

using System;
using System.Reflection;
using System.Web.Mvc;

namespace Single_SignOn.Attributes
{
    [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
    public class AcceptSubmitTypeAttribute : ActionMethodSelectorAttribute
    {
        public string Name { get; set; }
        public string Type { get; set; }

        public override bool IsValidForRequest(ControllerContext controllerContext, MethodInfo methodInfo)
        {
            return controllerContext.RequestContext.HttpContext
                .Request.Form[this.Name] == this.Type;
        }
    }
}